Popup.prototype.init=function (url, width, height) {
	this.url=url;
	this.width=width;
	this.height=height;
	this.windowName="popup"+Math.floor(Math.random()*100000000);
	this.windowFeatures="scrollbars=none,resizable=yes,menubar=no";
	//this.params=null;
}


Popup.prototype.open=function (url) {
	this.window=window.open(url, this.windowName, String.format("width={0},height={1},", this.width, this.height)+this.windowFeatures);
	return this.window;	
}

Popup.prototype.get=function (params) {
	this.open(Utils.buildQueryString(this.url, params)).focus();
	return this.window;
}

Popup.prototype.post=function (params) {
	this.open("");
	
	var form=document.createElement("form");
	form.method="post";
	form.action=this.url;
	form.target=this.windowName;
	
	for (var i=0; i<params.getCount(); i++){
		var input=document.createElement("input");
		input.type="hidden";
		input.name=params.keys[i];
		input.value=params.values[i];
		form.appendChild(input);
	}

	top.document.body.appendChild(form);
	form.submit();
	top.document.body.removeChild(form);	
	this.window.focus();
	return this.window;			
}

function Popup(url, width, height){
	if (arguments.length>0){
		this.init(url, width, height)
	}
}
